﻿using System;
using System.Configuration;

namespace Ext.Direct.Mvc.Configuration
{
    public class DirectConfig
    {
        private static readonly DirectSection _directSection;

        static DirectConfig() {
            _directSection = ConfigurationManager.GetSection("ext.direct") as DirectSection;
            if (_directSection == null || _directSection.Equals(new DirectSection())) {
                throw new ConfigurationErrorsException("Could not find section 'ext.direct' in the configuration file.");
            }
        }

        public static string ProviderName {
            get { return _directSection.ProviderName; }
        }

        public static string ApiUrl {
            get { return _directSection.ApiUrl; }
        }

        public static string RouterUrl {
            get { return _directSection.RouterUrl; }
        }

        public static string Namespace {
            get { return _directSection.Namespace; }
        }

        public static string Assembly {
            get { return _directSection.Assembly; }
        }

        public static int? Buffer {
            get { return _directSection.Buffer; }
        }
    }
}
